Skip to content

feat(grpc): log per-request [REQ] line for #92 evidence slice#105

Merged
SyniRon merged 1 commit into
developfrom
feat/issue-92-grpc-request-log
May 29, 2026
Merged

feat(grpc): log per-request [REQ] line for #92 evidence slice#105
SyniRon merged 1 commit into
developfrom
feat/issue-92-grpc-request-log

Conversation

@SyniRon
Copy link
Copy Markdown
Collaborator

@SyniRon SyniRon commented May 29, 2026

Evidence slice for #92. Adds a defer'd log line to the gRPC UnaryInterceptor so every call emits:

[REQ] transport=grpc method=<full_method> peer=<addr> key_id=<id|none>

Why this shape

Scope intentionally narrow — no HTTP gateway counter, no Redis persistence, no stack choice. Probe is throwaway; the long-term analytics surface gets picked when #94/#95 close.

Test plan

  • go test ./... — passes; two new tests in auth_test.go cover the success and auth-failure log paths.

  • go build -v ./...

  • make lint

  • make generate (no drift)

  • go mod tidy (no drift)

  • Local-stack smoke (CLAUDE.md manual review gate, auth touch). Observed on local API + xenforo-db + dev-redis:

    • HTTP gateway hit → [REQ] transport=grpc method=/proto.MilpacService/GetRoster peer=127.0.0.1:62807 key_id=3
    • Direct grpcurl with valid bearer → ... peer=127.0.0.1:62870 key_id=3 (distinct port from gateway dial)
    • Direct grpcurl with no bearer → ... peer=127.0.0.1:62873 key_id=none + Unauthenticated
    • Direct grpcurl with bogus bearer → ... peer=127.0.0.1:62874 key_id=none + Unauthenticated

    Local stack has no nginx so all peers are 127.0.0.1; in prod the gateway dial will be loopback and external traffic will show the nginx container IP — that's the disambiguation.

🤖 Generated with Claude Code

Evidence slice for #92. Adds a defer'd log line on every unary gRPC
call (auth-success and auth-failure paths both emit) carrying
transport, full method, peer address, and resolved key_id (or "none"
for unauthenticated requests). Loopback peer disambiguates the
in-process gateway dial from external traffic, unblocking the
"is anyone hitting :10000 externally" question for #94/#95.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@SyniRon SyniRon force-pushed the feat/issue-92-grpc-request-log branch from f1c871e to bbfcb9f Compare May 29, 2026 04:03
Copy link
Copy Markdown
Collaborator Author

@SyniRon SyniRon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good

@SyniRon SyniRon merged commit dfb5af2 into develop May 29, 2026
2 checks passed
@SyniRon SyniRon deleted the feat/issue-92-grpc-request-log branch May 29, 2026 04:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant